//package com.ruiwen.imuser.config;
//
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import springfox.documentation.builders.ApiInfoBuilder;
//import springfox.documentation.builders.PathSelectors;
//import springfox.documentation.service.ApiInfo;
//import springfox.documentation.spi.DocumentationType;
//import springfox.documentation.spring.web.plugins.Docket;
//import springfox.documentation.swagger2.annotations.EnableSwagger2;
//
//import static springfox.documentation.builders.RequestHandlerSelectors.basePackage;
//
///**
// * @author ADMIN
// * @date 2020/11/21 18:39
// */
//@Configuration
//@EnableSwagger2
//public class SwaggerConfig {
//    @Autowired
//    private SwaggerProperties swaggerProperties;
//
//    @Bean
//    public Docket createRestApi() {
//        return new Docket(DocumentationType.SWAGGER_2)
//                .apiInfo(apiInfo())
//                .select()
//                .apis(basePackage(swaggerProperties.getBasePackage()))
//                .paths(PathSelectors.any())
//                .build();
//    }
//
//    private ApiInfo apiInfo() {
//        return new ApiInfoBuilder().title(swaggerProperties.getTitle())
//                .description(swaggerProperties.getDescription())
//                .termsOfServiceUrl(swaggerProperties.getLicenseUrl())
//                .version(swaggerProperties.getVersion())
//                .build();
//    }
//
////    public static Predicate<RequestHandler> basePackage(final String basePackage) {
////        return input -> declaringClass(input).transform(handlerPackage(basePackage)).or(true);
////    }
////
////    private static Function<Class<?>, Boolean> handlerPackage(final String basePackage) {
////        return input -> {
////            // 循环判断匹配
////            for (String strPackage : basePackage.split(",")) {
////                boolean isMatch = input.getPackage().getName().startsWith(strPackage);
////                if (isMatch) {
////                    return true;
////                }
////            }
////            return false;
////        };
////    }
////
////    private static Optional<? extends Class<?>> declaringClass(RequestHandler input) {
////        return Optional.fromNullable(input.declaringClass());
////    }
//}
